import {LocalStorage} from 'quasar';
import {defaultValue} from 'src/lib/util/box'

export default function () {
  let name = LocalStorage.getItem('name');
  let box = LocalStorage.getItem('box') || [];
  for (let i in box) {
    if (box[i].id) {
      box[i] = {
        ...defaultValue(),
        ...box[i]
      }
    }
  }
  return {name, box};
}
